package cn.silver.module.system.enums;

import cn.silver.framework.core.model.DictModel;
import cn.silver.framework.core.utils.StreamUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

/**
 * @author zhouxiaobo
 */

@Getter
@AllArgsConstructor
public enum RoleTypeEnums {

    SUPER_ROLE("super_admin", "超级管理员", RoleScopeEnums.ALL_SCOPE.getCode(), Boolean.TRUE),
    SYSTEM_ROLE("system_admin", "系统管理员", RoleScopeEnums.ALL_SCOPE.getCode(), Boolean.FALSE),
    TENANT_ROLE("tenant_admin", "租户管理员", RoleScopeEnums.TENANT_SCOPE.getCode(), Boolean.FALSE),
    ORGAN_ROLE("dept_admin", "组织管理员", RoleScopeEnums.DEPT_ALL_SCOPE.getCode(), Boolean.FALSE),
    COMMON_ROLE("common_user", "普通用户", RoleScopeEnums.CURRENT_SCOPE.getCode(), Boolean.FALSE),
    DEFAULT_ROLE("default_user", "默认角色", RoleScopeEnums.CURRENT_SCOPE.getCode(), Boolean.TRUE),
    ;
    private final String code;
    private final String name;
    private final String scope;
    private final Boolean built;

    public static List<DictModel> getModels() {
        return StreamUtils.toList(Arrays.asList(values()), item -> new DictModel(item.name, item.code));
    }
}
